import request, {sign} from '@/utils/request';
const obj = {};

// 获取验证码
obj.getVerificationCode = function (data) {
  return request({
    url: `${sign}/login/getVerificationCode?key=${data.key}`,
    method: 'get',
    noToken: true
  });
};

// 登录
obj.login = function (data) {
  return request({
    url: `${sign}/login`,
    method: 'post',
    noToken: true,
    data
  });
};

// 获取当前登陆用户信息
obj.getUserByToken = function (data) {
  return request({
    url: `${sign}/login/getUserByToken`,
    method: 'get',
    data
  });
};

// 登出
obj.logout = function (data) {
  return request({
    url: `${sign}/login/logout`,
    method: 'post',
    data
  });
};

export default obj;
